cmake_minimum_required(VERSION 2.6)

# Path to local modules
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/)

PROJECT (Vigilante)

SET(MAJOR_VERSION 0)
SET(MINOR_VERSION 9)
SET(PATCH_LEVEL 0)
SET(${PROJECT_NAME}_SOVERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_LEVEL})
SET(${PROJECT_NAME}_VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_LEVEL})


SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")

FILE(GLOB_RECURSE VIGILANTE_SRC sources/*.cpp)



FIND_PACKAGE(SDL REQUIRED)
FIND_PACKAGE(SDL_image REQUIRED)
IF(SDL_FOUND AND SDLIMAGE_FOUND)  
    include_directories(${SDL_INCLUDE_DIR})
    include_directories(${SDLIMAGE_INCLUDE_DIR})
ENDIF(SDL_FOUND AND SDLIMAGE_FOUND)

FIND_PACKAGE( Boost 1.35.0 COMPONENTS program_options)
IF(Boost_FOUND)
    link_directories(${Boost_LIBRARY_DIRS})
    include_directories(${Boost_INCLUDE_DIRS})
ENDIF(Boost_FOUND)


#pkg-config dependant part

find_package(PkgConfig)

pkg_check_modules(GTKMM REQUIRED gtkmm-2.4)
IF(GTKMM_FOUND)
    link_directories(${GTKMM_LIBRARY_DIRS})
    include_directories(${GTKMM_INCLUDE_DIRS})
ENDIF(GTKMM_FOUND)

pkg_check_modules(LIBGLADEMM REQUIRED libglademm-2.4)
IF(LIBGLADEMM_FOUND)
    link_directories(${LIBGLADEMM_LIBRARY_DIRS})
    include_directories(${LIBGLADEMM_INCLUDE_DIRS})
ENDIF(LIBGLADEMM_FOUND)

pkg_check_modules(CLUTTERMM REQUIRED cluttermm-0.8)
IF(CLUTTERMM_FOUND)
    link_directories(${CLUTTERMM_LIBRARY_DIRS})
    include_directories(${CLUTTERMM_INCLUDE_DIRS})
ENDIF(CLUTTERMM_FOUND)

pkg_check_modules(CLUTTER-GSTREAMERMM REQUIRED clutter-gstreamermm-0.8)
IF(CLUTTER-GSTREAMERMM_FOUND)
    link_directories(${CLUTTER-GSTREAMERMM_LIBRARY_DIRS})
    include_directories(${CLUTTER-GSTREAMERMM_INCLUDE_DIRS})
ENDIF(CLUTTER-GSTREAMERMM_FOUND)

pkg_check_modules(GSTREAMERMM REQUIRED gstreamermm-0.10)
IF(GSTREAMERMM_FOUND)
    link_directories(${GSTREAMERMM_LIBRARY_DIRS})
    include_directories(${GSTREAMERMM_INCLUDE_DIRS})
ENDIF(GSTREAMERMM_FOUND)

pkg_check_modules(GSTREAMERBASEMM REQUIRED gstreamerbasemm-0.10)
IF(GSTREAMERBASEMM_FOUND)
    link_directories(${GSTREAMERBASEMM_LIBRARY_DIRS})
    include_directories(${GSTREAMERBASEMM_INCLUDE_DIRS})
ENDIF(GSTREAMERBASEMM_FOUND)


get_directory_property(inc_dirs INCLUDE_DIRECTORIES)
file(WRITE cmake_build/include_dirs.txt ${inc_dirs})


ADD_EXECUTABLE(${PROJECT_NAME} ${VIGILANTE_SRC})
target_link_libraries(${PROJECT_NAME}
                        ${SDL_LIBRARY}
                        ${SDLIMAGE_LIBRARY}
                        ${GTKMM_LIBRARIES}
                        ${LIBGLADEMM_LIBRARIES}
                        ${CLUTTERMM_LIBRARIES}
                        ${CLUTTER-GSTREAMERMM_LIBRARIES}
                        ${GSTREAMERMM_LIBRARIES}
                        ${GSTREAMERBASEMM_LIBRARIES}
                        ${Boost_LIBRARIES})
